from django.urls import re_path, path
from rest_framework.routers import SimpleRouter
from question.views import *

urlpatterns = [

    # 最新回答的问题
    re_path(r'^questions/(?P<pk>.+)/label/new/$', NewQusetionsView.as_view()),
    re_path(r'^questions/(?P<pk>.+)/label/hot/$', HotQusetionsView.as_view()),
    re_path(r'^questions/(?P<pk>.+)/label/wait/$', WaitQusetionsView.as_view()),

    # 回答问题
    # re_path(r'^reply/$', ReplyViewSet.as_view({'post': 'create'})),

    re_path(r'^reply/(?P<pk>\d+)/useful/$', ReplyUsefulAPIView.as_view()),

    re_path(r'^reply/(?P<pk>\d+)/unuseful/$', ReplyUnusefulAPIView.as_view()),




]






# 标签
router = SimpleRouter()  # 创建路由对象
router.register(prefix='labels', viewset=LabelsViewSet, basename='labels')  # 注册路由
urlpatterns += router.urls

# 问题
router = SimpleRouter()  # 创建路由对象
router.register(prefix='questions', viewset=QuestionsViewSet, basename='questions')  # 注册路由
urlpatterns += router.urls

# 回答
router = SimpleRouter()  # 创建路由对象
router.register(prefix='reply', viewset=ReplyViewSet, basename='reply')  # 注册路由
urlpatterns += router.urls